#include <avz.h>

using namespace AvZ;

void Script()
{
    OpenMultipleEffective('Q', AvZ::MAIN_UI_OR_FIGHT_UI);
    GetPvzBase()->mPtr<PvzStruct>(0x82c)->mRef<int>(0x214) = -5;

    SetZombies({
        ZOMBIE,
        POLE_VAULTING_ZOMBIE,
        FOOTBALL_ZOMBIE,
        DANCING_ZOMBIE,
        ZOMBONI,
        JACK_IN_THE_BOX_ZOMBIE,
        DIGGER_ZOMBIE,
        POGO_ZOMBIE,
        BUNGEE_ZOMBIE,
        LADDER_ZOMBIE,
        CATAPULT_ZOMBIE,
        GARGANTUAR,
        GIGA_GARGANTUAR,
        DOLPHIN_RIDER_ZOMBIE,
        SNORKEL_ZOMBIE,
    });

    SelectCards({
        PUFF_SHROOM,
    });

    SetTime(-599, 1);
    pao_operator.autoGetPaoList();
    AvZ::MaidCheats::dancing();

    for (auto wave : {1, 3, 5, 6, 8, 10, 12, 14, 15, 17})
    {
        // PPDD 657
        SetTime(457 - 373, wave);
        pao_operator.pao({{2, 8.4625}, {5, 8.4625}});
        Delay(113);
        pao_operator.pao({{1, 7.3875}, {5, 7.3875}});
    }

    for (auto wave : {2, 4, 7, 11, 13, 16, 18})
    {
        // cPPdd 752
        SetTime(552 - 373, wave);
        pao_operator.pao({{2, 8.375}, {5, 8.375}});
        Delay(224);
        pao_operator.pao({{1, 4.2}, {5, 4.2}});
        SetTime(170);
        Card(PUFF_SHROOM, 1, 9);
        SetTime(249);
        Shovel(1, 9);
    }

    for (auto wave : {9})
    {
        // cPPdd-PPDD-PP
        SetTime(552 - 373, wave);
        pao_operator.pao({{2, 8.375}, {5, 8.375}});
        Delay(224);
        pao_operator.pao({{1, 4.2}, {5, 4.2}});
        SetTime(170);
        Card(PUFF_SHROOM, 1, 9);
        SetTime(249);
        Shovel(1, 9);

        SetTime(752 + 457 - 373);
        pao_operator.pao({{2, 8}, {5, 8}});
        Delay(113);
        pao_operator.pao({{1, 7.8125}, {5, 7.8125}});

        SetTime(752 + 657 + 552 - 373);
        pao_operator.pao({{2, 8}, {5, 8}});
    }

    for (auto wave : {19})
    {
        // PPDD-PPDD-PP
        SetTime(457 - 373, wave);
        pao_operator.pao({{2, 8.4625}, {5, 8.4625}});
        Delay(113);
        pao_operator.pao({{1, 7.3875}, {5, 7.3875}});

        SetTime(657 + 457 - 373);
        pao_operator.pao({{2, 8}, {5, 8}});
        Delay(113);
        pao_operator.pao({{1, 8.1375}, {5, 8.1375}});

        SetTime(657 + 657 + 552 - 373);
        pao_operator.pao({{2, 8}, {5, 8}});
    }

    SetTime(-150, 20);
    pao_operator.pao(4, 7.5875);
    AvZ::MaidCheats::stop();
    SetTime(341 - 373);
    pao_operator.pao({{2, 9}, {5, 9}, {2, 9}, {5, 9}});
    Delay(125);
    pao_operator.pao({{1, 9}, {5, 9}});
    SetTime(813 - 373);
    pao_operator.pao({{2, 9}, {5, 9}});
}